/**
 * Created by admin on 2016/11/29.
 */
var assert = require('../assert');
exports.share = function (req,res,next) {
    var JADE_VAR = assert.getJADEVAR();
    var userId = assert.getUserId(req);
    var orderId = req.params.orderId;
    if(!userId){
        res.render('error', assert.getRes(103, "获取用户信息失败", '', true));
        return;
    }
    if(!orderId){
        res.render('error', assert.getRes(102, "获取订单信息失败", '', true));
        return;
    }
    assert.apiParseRequest('get', '/kdOrders/' + orderId+'?isShort=1', {}).then(function (result) {
        if (result) {
            JADE_VAR.order = result;
            res.render('share/share',JADE_VAR);
        } else {
            res.render('error', assert.getRes(102, "获取失败", {}, true));
        }
    }, function (err, error) {
        res.render('error',assert.getRes(404,"服务器错误",{},true));
    });

};
